package cn.edu.jsu.official.utils;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @author Mo
 * @createTime 2022/3/31 11:09
 * @description
 */
public class CollectionUtil {
    public static <T> List<T> listRemoveNullBySerial(List<T> listWithNulls) {
        return listWithNulls.stream()
                .filter(Objects::nonNull)
                .collect(Collectors.toList());
    }

    public static <T> List<T> listRemoveNullByParallel(List<T> listWithNulls) {
        return listWithNulls.parallelStream()
                .filter(Objects::nonNull)
                .collect(Collectors.toList());
    }
}
